import time
from rest_framework.response import Response

class Util:
    @staticmethod
    def check_data_key(data,key):
        return all([k in data for k in key])

    @staticmethod
    def say_yes(data,status=None):
        if status:
            return Response({'code':1, 'msg':'success', 'time':time.ctime(), 'data':data},status=status)
        return Response({'code':1, 'msg':'success', 'time':time.ctime(), 'data':data})

    @staticmethod
    def say_no(data,status=None):
        if status:
            return Response({'code':0, 'msg':'fail', 'time':time.ctime(), 'data':data},status=status)
        return Response({'code':0, 'msg':'fail', 'time':time.ctime(), 'data':data})
        
    
